PROJECT(kfext_binance)

set(CMAKE_CXX_STANDARD 20)

add_definitions(
    -UNDEBUG
    -DDTF_HEADER_ONLY
)

INCLUDE_DIRECTORIES(include)
# LINK_DIRECTORIES(${API_LIB_PATH})

AUX_SOURCE_DIRECTORY(src SOURCE_FILES)
FILE(GLOB BINAPI_SOURCES
    "src/binapi/*.cpp"
)

SET(KF_EXTENSION_BUILD_DIR ${KF_EXTENSIONS_BUILD_DIR}/binance)

CONFIGURE_FILE(__init__.py "${KF_EXTENSION_BUILD_DIR}/__init__.py")
CONFIGURE_FILE(package.json "${KF_EXTENSION_BUILD_DIR}/package.json")

PYBIND11_ADD_MODULE(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${BINAPI_SOURCES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${KF_EXTENSION_BUILD_DIR})
IF(WIN32)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${KF_EXTENSION_BUILD_DIR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${KF_EXTENSION_BUILD_DIR})
ENDIF()

TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE wingchun yijinjing crypto ssl pthread z -L${BOOST_LIB_DIR})
# FILE(GLOB DLLS "${API_LIB_PATH}/*")
# FILE(COPY ${DLLS} DESTINATION ${KF_EXTENSION_BUILD_DIR})

ADD_CUSTOM_COMMAND(OUTPUT package_json
        COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/package.json ${KF_EXTENSION_BUILD_DIR})
ADD_CUSTOM_TARGET(kfext_binance_package_json ALL DEPENDS package_json)
